package TestDemo;

import java.io.*;

public class TestDemo1 {
    public static void main(String[] args) throws IOException {
//        File file = new File("test1.txt");
//        file.createNewFile();

        InputStream inputStream = new FileInputStream("test1.txt");

//        while (true) {
//            int b = inputStream.read();
//            if (b == -1) {
//                break;
//            }
//            System.out.println(b);
//        }

        byte[] b = new byte[1024];
        int len = inputStream.read(b);
//        System.out.println(len);
//        for (int i = 0; i < len; i++) {
//            System.out.println(b[i]);
//        }

        String s = new String(b, 0, len, "utf8");
        System.out.println(s);

        inputStream.close();
    }
}
